RWTH - Mindstorms NXT Toolbox

SetAngleLimit

Sets the angle limit (in degrees) of the current motor port

Contents

Syntax

SetAngleLimit(limt)

Description

SetAngleLimit(limt) sets the angle limit in degrees for the current motor, which is set by function SetMotor. This setting takes only affect with the next SendMotorSettings command.

Use SetAngleLimit(0) to deactivate this limit (hence the motor will run forever).

Note:

This commmand provides an automatically limited motor rotation. The NXT Brick will try to rotate only to the angle which is set. Unfortunately if the power is set too high, the target angle will be slightly missed, as the motor has still enough angular momentum to keep spinning a bit. Ways around can be to slow down the motor before it approaches its angle limit and then keep going very carefully, or to willingly miss the angle limit and then reverse back to where you want to go precisely.

Example

   SetMotor(MOTOR_B);
   	SetPower(76);
   	SetAngleLimit(720);
   SendMotorSettings();

See also

SendMotorSettings, SetMotor, GetMotor

Signature